package cn.stylefeng.guns.modular.shuheng.controller;

import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.Constants;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.core.common.page.LayuiPageFactory;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.core.util.DateUtil;
import cn.stylefeng.guns.core.util.HtmlUtil;
import cn.stylefeng.guns.modular.shuheng.entity.Data;
import cn.stylefeng.guns.modular.shuheng.entity.Region;
import cn.stylefeng.guns.modular.shuheng.service.DataService;
import cn.stylefeng.guns.modular.shuheng.service.FilesService;
import cn.stylefeng.guns.modular.shuheng.service.LevelService;
import cn.stylefeng.guns.modular.shuheng.service.RegionService;
import cn.stylefeng.guns.modular.shuheng.state.QuarterEnum;
import cn.stylefeng.guns.modular.shuheng.warpper.FilesWrapper;
import cn.stylefeng.guns.modular.shuheng.warpper.ProblemWrapper;
import cn.stylefeng.guns.modular.shuheng.warpper.RegionWrapper;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.*;

/**
 * 数据表
 */
@Controller
@RequestMapping("/chart")
public class ChartController {
    private String PREFIX = "/modular/shuheng/chart/";

    @Autowired
    private FilesService filesService;

    @Autowired
    private DataService dataService;

    @Autowired
    private LevelService levelService;

    @Autowired
    private RegionService regionService;

    @RequestMapping("")
    public String index(@RequestParam(value = "year",required = false) Integer year,
                        Model model){
        //在level中查询系统中存在的年份
        List<Integer> list = levelService.listYears();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        model.addAttribute("yearList",list);
        model.addAttribute("nowYear",nowYear);
        return PREFIX +"chart.html";
    }

    @RequestMapping("/cityIndex")
    public String cityIndex(@RequestParam(value = "year",required = false) Integer year,
                        Model model){
        //在level中查询系统中存在的年份
        List<Integer> list = levelService.listYears();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        model.addAttribute("yearList",list);
        model.addAttribute("nowYear",nowYear);
        return PREFIX +"city_chart.html";
    }


    /**
     * 市排名数据
     * @return
     */
    @RequestMapping("/cityRankData")
    @ResponseBody
    public List<Map<String,Object>> cityRankData(@RequestParam(value = "year",required = false) Integer year,
                                                 @RequestParam(value = "quarter",required = false) String quarter){
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<Map<String,Object>> list = dataService.listCityRankData(year,quarterArr);
        return list;
    }

    /**
     * 区县排名数据
     * @return
     */
    @RequestMapping("/countyRankData")
    @ResponseBody
    public List<Map<String,Object>> countyRankData(@RequestParam(value = "year",required = false) Integer year,
                                                   @RequestParam(value = "quarter",required = false) String quarter){
        ShiroUser user = ShiroKit.getUser();
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<Map<String,Object>> list = dataService.listCountyRankData(year,quarterArr,user.getUserLevel(),user.getCity());
        return list;
    }

    /**
     * 市完成率数据表数据
     * @return
     */
    @RequestMapping("/cityCompletionData")
    @ResponseBody
    public List<Map<String,Object>> cityCompletionData(@RequestParam(value = "year",required = false) Integer year,
                                                       @RequestParam(value = "quarter",required = false) String quarter){
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<Map<String,Object>> list = dataService.listCityCompletionData(year,quarterArr);
        return list;
    }

    /**
     * 区县完成率数据表数据。倒数20名
     * @return
     */
    @RequestMapping("/countyCompletionData")
    @ResponseBody
    public List<Map<String,Object>> countyCompletionData(@RequestParam(value = "year",required = false) Integer year,
                                                         @RequestParam(value = "quarter",required = false) String quarter){
        ShiroUser user = ShiroKit.getUser();
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<Map<String,Object>> list = dataService.listCountyCompletionData(year,quarterArr,user.getUserLevel(),user.getCity());
        return list;
    }

    /**
     * 完成率占比，只计算区县的
     * @param city
     * @return
     */
    @RequestMapping("/completionData")
    @ResponseBody
    public List<Map<String,Object>> completionData(@RequestParam(value = "city",required = false) String city,
                                                   @RequestParam(value = "year",required = false) Integer year,
                                                   @RequestParam(value = "quarter",required = false) String quarter){
        ShiroUser user = ShiroKit.getUser();
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        List<Map<String,Object>> list = new ArrayList<>();
        String[] quarterArr = QuarterEnum.getArr(quarter);
//        List<Map<String,Object>> cityList = dataService.listCompletionByCity(year,quarterArr);
        List<Map<String,Object>> countyList = dataService.listCompletionByCounty(year,quarterArr,user.getUserLevel(),user.getCity());
//        if(cityList!=null){
//            list.addAll(cityList);
//        }
        if(countyList!=null){
            list.addAll(countyList);
        }
        List<Map<String,Object>> dataList = new ArrayList<>();
        int count90 = 0;
        int count80 = 0;
        int count70 = 0;
        int count60 = 0;
        int count60low = 0;
        for(int i=0;i<list.size();i++){
            BigDecimal value = (BigDecimal)list.get(i).get("value");
            if(value.compareTo(BigDecimal.valueOf(90))>=0){
                count90 ++ ;
            }else if(value.compareTo(BigDecimal.valueOf(80))>=0){
                count80 ++ ;
            }else if(value.compareTo(BigDecimal.valueOf(70))>=0){
                count70 ++;
            }else if(value.compareTo(BigDecimal.valueOf(60))>=0){
                count60 ++;
            }else{
                count60low ++ ;
            }
        }
        HashMap<String,Object> map90 = new HashMap<>();
        map90.put("name","90%以上");
        map90.put("value",count90);
        dataList.add(map90);
        HashMap<String,Object> map80 = new HashMap<>();
        map80.put("name","80%-90%");
        map80.put("value",count80);
        dataList.add(map80);
        HashMap<String,Object> map70 = new HashMap<>();
        map70.put("name","70%-80%");
        map70.put("value",count70);
        dataList.add(map70);
        HashMap<String,Object> map60 = new HashMap<>();
        map60.put("name","60%-70%");
        map60.put("value",count60);
        dataList.add(map60);
        HashMap<String,Object> map60low = new HashMap<>();
        map60low.put("name","60%以下");
        map60low.put("value",count60low);
        dataList.add(map60low);
        return dataList;

    }

    /**
     * 山东省地图
     * @return
     */
    @RequestMapping("/mapCityList")
    @ResponseBody
    public List<List<Map<String,Object>>> mapCityList(@RequestParam(value = "year",required = false) Integer year,
                                                      @RequestParam(value = "quarter",required = false) String quarter){
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<List<Map<String,Object>>> list = new ArrayList<>();
        List<Region> regionList = regionService.listCity(16L);
        if(regionList!=null && regionList.size()>0){
            for(Region region:regionList){
                List<Map<String,Object>> cityMapList = dataService.mapByCity(year,quarterArr,region.getRegionId());
                list.add(cityMapList);
            }
        }
        return list;
    }


    /**
     * 地市地图
     * @return
     */
    @RequestMapping("/mapCountyList")
    @ResponseBody
    public List<List<Map<String,Object>>> mapCountyList(@RequestParam(value = "year",required = false) Integer year,
                                                      @RequestParam(value = "quarter",required = false) String quarter){
        ShiroUser user = ShiroKit.getUser();
        if(ToolUtil.isEmpty(year)){
            year = DateUtil.getNowYear();
        }
        String[] quarterArr = QuarterEnum.getArr(quarter);
        List<List<Map<String,Object>>> list = new ArrayList<>();
        List<Region> regionList = regionService.listCounty(user.getCity());
        if(regionList!=null && regionList.size()>0){
            for(Region region:regionList){
                List<Map<String,Object>> cityMapList = dataService.mapByCounty(year,quarterArr,region.getRegionId());
                list.add(cityMapList);
            }
        }
        return list;
    }

    /**
     * 跳转排名页面
     * @param year
     * @param model
     * @return
     */
    @RequestMapping("/rankIndex")
    public String rankIndex(@RequestParam(value = "year",required = false) Integer year,
                            Model model){
        ShiroUser user = ShiroKit.getUser();

        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        List<Integer> list = new ArrayList<>();
        list.add(nowYear);
        list.add(nowYear +1);
        list.add(nowYear +2);
        model.addAttribute("yearList",list);
        if(ToolUtil.isEmpty(year)){
            year = nowYear;
        }

        model.addAttribute("userLevel",user.getUserLevel());
        model.addAttribute("city",user.getCity());

        return PREFIX + "rank.html";
    }

    /**
     * 排名列表
     * @param year
     * @param rankType
     * @param city
     * @return
     */
    @RequestMapping("/rankList")
    @ResponseBody
    public Object rankList(@RequestParam(value = "year",required = false) Integer year,
                           @RequestParam(value = "month",required = false) String[] month,
                           @RequestParam(value = "rankType", required = false) Integer rankType,
                           @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(rankType)){
                rankType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            rankType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        Page<Map<String, Object>> list = new Page<>();
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }

        if(rankType==2){
            list = this.dataService.listCityRank(year,rankType,quarterArr);
        }else{
            list = this.dataService.listCountyRank(user.getUserLevel(),year,city,rankType,quarterArr);
        }
        Page<Map<String, Object>> wrap = new RegionWrapper(list).wrap();
        return LayuiPageFactory.createPageInfo(wrap);
    }

    /**
     * 排名excel导出
     * @param year
     * @param rankType
     * @param city
     * @return
     */
    @RequestMapping("/exportRankExcel")
    @ResponseBody
    public List<Map<String,Object>> exportExcel(@RequestParam(value = "year",required = false) Integer year,
                                                @RequestParam(value = "month",required = false) String[] month,
                                                @RequestParam(value = "rankType", required = false) Integer rankType,
                                                @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(rankType)){
                rankType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            rankType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        List<Map<String,Object>> list = new ArrayList<>();
        if(rankType==2){
            list = this.dataService.excelCityRank(year,rankType,quarterArr);
        }else{
            list = this.dataService.excelCountyRank(user.getUserLevel(),year,city,rankType,quarterArr);
        }
        list = new RegionWrapper(list).wrap();
        return list;
    }

    /**
     * 跳转完成率页面
     * @param year
     * @param model
     * @return
     */
    @RequestMapping("completionIndex")
    public String completionIndex(@RequestParam(value = "year",required = false) Integer year,
                                  Model model){
        ShiroUser user = ShiroKit.getUser();

        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        List<Integer> list = new ArrayList<>();
        list.add(nowYear);
        list.add(nowYear +1);
        list.add(nowYear +2);
        model.addAttribute("yearList",list);
        if(ToolUtil.isEmpty(year)){
            year = nowYear;
        }

        model.addAttribute("userLevel",user.getUserLevel());
        model.addAttribute("city",user.getCity());

        return PREFIX + "completion.html";
    }

    /**
     * 完成率列表接口
     * @param year
     * @param rankType
     * @param city
     * @return
     */
    @RequestMapping("/completionList")
    @ResponseBody
    public Object completionList(@RequestParam(value = "year",required = false) Integer year,
                                 @RequestParam(value = "month",required = false) String[] month,
                           @RequestParam(value = "rankType", required = false) Integer rankType,
                           @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(rankType)){
                rankType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            rankType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        Page<Map<String, Object>> list = new Page<>();
        if(rankType==2){
            list = this.dataService.listCityCompletion(year,rankType,quarterArr);
        }else{
            list = this.dataService.listCountyCompletion(user.getUserLevel(),year,city,rankType,quarterArr);
        }
        Page<Map<String, Object>> wrap = new RegionWrapper(list).wrap();
        return LayuiPageFactory.createPageInfo(wrap);
    }


    @RequestMapping("/exportCompletionExcel")
    @ResponseBody
    public List<Map<String,Object>> exportCompletionExcel(@RequestParam(value = "year",required = false) Integer year,
                                                          @RequestParam(value = "month",required = false) String[] month,
                                                @RequestParam(value = "rankType", required = false) Integer rankType,
                                                @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(rankType)){
                rankType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            rankType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        List<Map<String,Object>> list = new ArrayList<>();
        if(rankType==2){
            list = this.dataService.excelCityCompletion(year,rankType,quarterArr);
        }else{
            list = this.dataService.excelCountyCompletion(user.getUserLevel(),year,city,rankType,quarterArr);
        }
        list = new RegionWrapper(list).wrap();
        return list;
    }

    /**
     * 跳转完成率页面
     * @param year
     * @param model
     * @return
     */
    @RequestMapping("/problemIndex")
    public String problemIndex(@RequestParam(value = "year",required = false) Integer year,
                                  Model model){
        ShiroUser user = ShiroKit.getUser();

        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        List<Integer> list = new ArrayList<>();
        list.add(nowYear);
        list.add(nowYear +1);
        list.add(nowYear +2);
        model.addAttribute("yearList",list);
        if(ToolUtil.isEmpty(year)){
            year = nowYear;
        }

        model.addAttribute("userLevel",user.getUserLevel());
        model.addAttribute("city",user.getCity());

        return PREFIX + "problem.html";
    }

    @RequestMapping("/problemList")
    @ResponseBody
    public Object problemList(@RequestParam(value = "year",required = false) Integer year,
                              @RequestParam(value = "month",required = false) String[] month,
                                 @RequestParam(value = "problemType", required = false) Integer problemType,
                                 @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(problemType)){
                problemType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            problemType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        Page<Map<String, Object>> list = new Page<>();
        if(problemType==2){
            list = this.dataService.listCityProblem(year,problemType,quarterArr);
        }else{
            list = this.dataService.listCountyProblem(user.getUserLevel(),year,city,problemType,quarterArr);
        }
        Page<Map<String, Object>> wrap = new ProblemWrapper(list).wrap();
        return LayuiPageFactory.createPageInfo(wrap);
    }

    @RequestMapping("/exportProblemExcel")
    @ResponseBody
    public List<Map<String,Object>> exportProblemExcel(@RequestParam(value = "year",required = false) Integer year,
                                                       @RequestParam(value = "month",required = false) String[] month,
                                                          @RequestParam(value = "problemType", required = false) Integer problemType,
                                                          @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(problemType)){
                problemType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            problemType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        List<Map<String,Object>> list = new ArrayList<>();
        if(problemType==2){
            list = this.dataService.listExcelCityProblem(year,problemType,quarterArr);
        }else{
            list = this.dataService.listExcelCountyProblem(user.getUserLevel(),year,city,problemType,quarterArr);
        }
        list = new ProblemWrapper(list).wrap();
        return list;
    }

    /**
     * 跳转问题检索
     * @param year
     * @param model
     * @return
     */
    @RequestMapping("/problemSearch")
    public String problemSearch(@RequestParam(value = "year",required = false) Integer year,
                               Model model){
        ShiroUser user = ShiroKit.getUser();

        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        List<Integer> list = new ArrayList<>();
        list.add(nowYear);
        list.add(nowYear +1);
        list.add(nowYear +2);
        model.addAttribute("yearList",list);
        if(ToolUtil.isEmpty(year)){
            year = nowYear;
        }

        model.addAttribute("userLevel",user.getUserLevel());
        model.addAttribute("city",user.getCity());

        return PREFIX + "problemSearch.html";
    }

    @RequestMapping("/problemSearchList")
    @ResponseBody
    public Object problemSearchList(@RequestParam(value = "year",required = false) Integer year,
                                    @RequestParam(value = "month",required = false) String[] month,
                              @RequestParam(value = "data",required = false) Long dataId,
                                    @RequestParam(value = "dataName",required = false) String dataName,
                              @RequestParam(value = "problemType", required = false) Integer problemType,
                              @RequestParam(value = "city",required = false) Long city){
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(problemType)){
                problemType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            city = user.getCity();
            problemType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        String[] quarterArr = null;
        if(month!=null && month.length>0){
            quarterArr = month;
        }
        Page<Map<String, Object>> list = new Page<>();
        if(problemType==2){
            list = this.dataService.listCityProblemSearch(year,problemType,dataId,dataName,quarterArr);
        }else{
            list = this.dataService.listCountyProblemSearch(user.getUserLevel(),year,city,problemType,dataId,dataName,quarterArr);
        }
        Page<Map<String, Object>> wrap = new FilesWrapper(list).wrap();
        return LayuiPageFactory.createPageInfo(wrap);
    }


    @RequestMapping(value = "/tree")
    @ResponseBody
    public List<ZTreeNode> tree(@RequestParam(value = "year",required = false) Integer year,
                                @RequestParam(value = "problemType",required = false)Integer problemType) {
        ShiroUser user = ShiroKit.getUser();
        Calendar calendar = Calendar.getInstance();
        Integer nowYear = calendar.get(Calendar.YEAR);
        if(year==null){
            year = nowYear;
        }
        if(user.getUserLevel()==1 || user.getAccount().equals("admin")){
            if(ToolUtil.isEmpty(problemType)){
                problemType = 2;
            }
        }
        if(user.getUserLevel()==2){
            //市级查看下边区县排名
            problemType = 3;
        }
        if(user.getUserLevel()==3){
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
        List<ZTreeNode> tree = this.levelService.tree(year,problemType);
        tree.add(ZTreeNode.createParent());
        return tree;
    }

    @RequestMapping(value = "/selectData")
    @ResponseBody
    public Object selectParent(@RequestParam(value = "parentId",required = false)String parentId){
        QueryWrapper<Data> wrapper = new QueryWrapper<>();
        wrapper.eq("content_id",parentId);
        wrapper.or();
        wrapper.eq("level_id",parentId);
        List<Map<String,Object>> list = dataService.listMaps(wrapper);
        String options = HtmlUtil.listMap2HtmlOptions(list,"data_id","data_name");
        return options;

    }
    /**
     * 季度列表 option
     * @return
     */
    @RequestMapping("/quarterList")
    @ResponseBody
    public String quarterList(){
        return QuarterEnum.toOption();
    }


}
